package day38.zuoye;

public class Tree {
    public static void main(String[] args) {
        long billion=1000000000L;
        double v = Math.log10(billion) / Math.log10(2);
        System.out.println(v);
        int ceil = (int) Math.ceil(v);
        System.out.println(ceil);
        System.out.println("-----换种方法");

        int height=1;
        Long sum=1L;
        Long index=1L;
        while (sum<(billion)){
            index=(index<<1);
            sum+=index;
            height++;
            if(sum>=(billion*2)){
                break;
            }
        }
        System.out.println("数据总数"+sum);
        System.out.println("二叉树深度"+(height-1));
        long l = (sum + 1) / 2;
        double number2 = Math.log10(l) / Math.log10(2);
        System.out.println(number2);
    }

}
